<?php
$this->Html->addCrumb('Ads main', '/admin/ads/main');
$this->Html->addCrumb('Coupons', '/admin/coupons');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#CouponAdminAddForm").TWS_Form( {
          validate : {
          rules : {
            CouponCompanyId : {required : true, help : "This is the company that the coupon is associated with."},
            CouponTitle : {required : true, help : "This is the title of the coupon.<br/><br/> e.g. 10% discount on all wedding dresses!"},
            CouponDescription : {required : true, help : "e.g. This is the description of the coupon.<br/><br/>Get 10% off of any Vera Wang wedding dress or accessories. Shoes are included too!"},
            CouponUrl : {url : true, help :"This can be used if the vendor has a coupon on their website and you wish to provide a direct link to their coupon. If this is populated, the link will go to their coupon page."},
            CouponStartDate :{date: true, help :"This is the start date that the coupon will be shown on the IsleVow website", required : true},
            CouponEndDate : {date:true, help: "This is the end date that the coupon will be shown until on the IsleVow website", required : true},
            CouponValidStartDate : {date:true, help:"This is the valid from start date that will be displayed on the coupon", required : true},
            CouponValidEndDate : {date:true, help:"This is the expiration date that will be displayed on the coupon", required : true},
            CouponImagePath : {help:"This is an optional image that could be uploaded that will be displayed on the coupon"}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Coupon</h1>

<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Coupons',array('action'=>'index','admin'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Coupon',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));
echo $this->TWSForm->input('company_id', array('name'=>'CouponCompanyId', 'type'=>'select', 'label'=>'<span class="required">*</span>Company', 'options'=>$options));
echo $this->TWSForm->input('title', array('name'=>'CouponTitle', 'size'=>'63', 'type'=>'text', 'label'=>'<span class="required">*</span>Title'));
echo $this->TWSForm->input('description', array('rows'=>'5','cols'=>'60','name'=>'CouponDescription', 'label'=>'<span class="required">*</span>Description'));

echo $this->TWSForm->input('start_date', array('type'=>'text', 'rel'=>'date','name'=>'CouponStartDate', 'label'=>'<span class="required">*</span>Start Date'));
echo $this->TWSForm->input('end_date', array('type'=>'text', 'rel'=>'date','name'=>'CouponEndDate', 'label'=>'<span class="required">*</span>End Date'));

echo $this->TWSForm->input('valid_start_date', array('type'=>'text', 'rel'=>'date','name'=>'CouponValidStartDate', 'label'=>'<span class="required">*</span>Coupon Valid From Date'));
echo $this->TWSForm->input('valid_end_date', array('type'=>'text', 'rel'=>'date','name'=>'CouponValidEndDate', 'label'=>'<span class="required">*</span>Coupon Valid To Date'));

echo $this->TWSForm->input('url', array('name'=>'CouponUrl', 'type'=>'text'));

echo $this->TWSForm->input('image_path', array('type'=>'file', 'label'=>'Upload image', 'name'=>'CouponImagePath', 'label'=>'Image for coupon'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));


?>